let mongoose = require("./index");

let usersSchema = new mongoose.Schema({
    phone:String,
    password:String,
    email:String,
    img:String,
    login_code:String,
    used: { type: Boolean }
  });
  let usersModel = mongoose.model("users", usersSchema, "users");
  let codeSchema = new mongoose.Schema({
    phone:String,
    email:String,
    code:String,
    login_code:String,
    createdAt: { type: Date, default: Date.now, expires: 600 }, // 10分钟后自动删除 (600秒 = 10分钟)
    used: { type: Boolean, default: false }
  });
  let codeModel = mongoose.model("code", codeSchema, "code");
  
  module.exports = {  usersModel,codeModel };